<?php

use common\server\BasicDataServer;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model backend\models\SearchHouseModel */
/* @var $form yii\widgets\ActiveForm */
$fieldOptions1 = [
    'options' => ['class' => 'form-group search-group'],
];

?>

<div class="house-model-search">

    <?php $form = ActiveForm::begin([
        'action' => ['index-select'],
        'method' => 'get',
        'id'=>'formsearch'
    ]); ?>


    <?= $form->field($model, 'house_name',$fieldOptions1)->label(false)->textInput(['placeholder' =>'关键字']) ?>
    <?php  echo $form->field($model, 'region_id',$fieldOptions1)->label(false)->dropDownList(BasicDataServer::instance()->getRegionToOptions(true), ['encodeSpaces' => 1]) ?>



    <div class="form-group">
        <?= Html::submitButton('搜索', ['class' => 'btn btn-primary','id'=>'searchbtn']) ?>
    </div>
	
	<?php
		$requestUrl = Url::toRoute('/house/index-select');
		$this->registerJs("$('#searchbtn').attr('type','button');
			$('#searchbtn').on('click', function () {		   
			    $.get('{$requestUrl}', $('#formsearch').serialize(),
		            function (data) {
		                $('.modal-body').html(data);
		            }  
		        );
		});");
	?>
	
    <?php ActiveForm::end(); ?>
    <div class="clearfix"></div>
</div>
